package cn.java.basic;

public class Student
{
    public int m_nId;
    public int m_nAge;

    public Student()
    {
        setStudent(1,20);
    }

    public Student(int id,int age)
    {
        setStudent(id,age);
    }

    public void setStudent(int id,int age)
    {
        m_nId=id;
        m_nAge=age;
    }

    public void setStudent(int id)
    {
        m_nId=id;
    }

    public int add(int a,int b)
    {
        return a+b;
    }

    public short add(short a,short b)
    {
        return (short)(a+b);
    }

    public float add(float a,float b)
    {
        return a+b;
    }

    public double add(double a,double b)
    {
        return a+b;
    }

    public String add(String a,String b)
    {
        return a.concat(b);
    }

    public static void main(String[] args)
    {
        Student zhang=new Student();
        zhang.setStudent(2);
        Student li=new Student();
        li.setStudent(3,19);
        System.out.println("zhang同学学号是"+zhang.m_nId+",年龄"+zhang.m_nAge);
        System.out.println("li同学学号是"+li.m_nId+",年龄"+li.m_nAge);

        int x=20,y=25;
        System.out.println("20+25="+zhang.add(x,y));
        double dbX=20.05,dbY=25.05;
        System.out.println("20.05+25.05="+zhang.add(dbX,dbY));
        String strX="我心",strY="狂野";
        System.out.println("我心+狂野="+li.add(strX,strY));
    }

}
